
/**
 * Callback method for when form is shown.
 *
 * @param {Boolean} firstShow form is shown first time after load
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"7835FEFA-71E7-4C3A-88FA-FEEED8A83997"}
 */
function onShow(firstShow, event) {
	_super.onShow(firstShow,event)
	controller.newRecord()
	promociones_cab_to_promociones_fotos.newRecord()
}

/**
 * @properties={typeid:24,uuid:"AB1D9413-2D59-4FC2-B70C-42003A3F8666"}
 */
function salir()
{
	databaseManager.setAutoSave(true)
	var $win = application.getWindow('ALTA_PROMO')
	$win.hide()
	$win.destroy()
}

/**
 * @properties={typeid:24,uuid:"64403868-6F97-4F63-A658-8883B11C47B3"}
 */
function guardar() {
	if (_super.guardar() == true)
	{
		salir()
	}
}

/**
 * @properties={typeid:24,uuid:"1DE74F62-52E8-4378-BC54-23FED5DA22A7"}
 */
function cancelar() {
	_super.cancelar()
	salir()
}
/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"D128E1B8-DF7D-4481-AF2C-3B190439F2F1"}
 */
function nuevaHabitacion(event) {
	var $sql = 'SELECT tipo_habitacion_id FROM tipos_habitacion WHERE es_habitacion = 1 ORDER BY limite_adulto ASC'
	var $ds = databaseManager.getDataSetByQuery('hoteleria',$sql,null,-1)
	
	var $win = application.createWindow('NUEVA_HABITACION',JSWindow.MODAL_DIALOG)
	$win.undecorated = true
	forms.promociones_dtl_alta.fFormLlama = 'promociones_cab_alta'
	forms.promociones_dtl_alta.controller.loadRecords($ds)
	forms.promociones_dtl_alta.controller.show($win)
}
